{extend name="layout:base" /}
{block name="page_content"}
  <div class="row maintop">
    <div class="col-xs-12">
      <form name="form_search" class="form-search form-inline" method="get" action="{:url('index')}">
        <div class="form-group">
          <label>关键词：</label>
          <div class="input-group">
            <span class="input-group-addon">
              <i class="ace-icon fa fa-check"></i>
            </span>
            <input type="text" name="keyword" id="keyword" class="form-control" value="{$param.keyword|default=''}" placeholder="请输入关键词" />
            <span class="input-group-btn">
              <button type="submit" class="btn btn-purple btn-sm">
                <span class="ace-icon fa fa-search icon-on-right bigger-110"></span>
                搜索
              </button>
            </span>
            </a>
          </div>
        </div>
        <div class="form-group">
          <a href="{:url('index')}" class="btn btn-sm  btn-purple ml-10">
            <span class="ace-icon fa fa-globe icon-on-right bigger-110"></span>
            显示全部
          </a>
        </div>
        <?php if($auth->check('export')): ?>
          <div class="form-group">
            <a href="{:url('export', $param)}" target="_blank" class="btn btn-sm btn-pink ml-10">
              <i class="ace-icon fa fa-download bigger-110"></i>
              导出数据
            </a>
          </div>
        <?php endif; ?>
      </form>
    </div>
  </div>

  <div class="row">
    <div class="col-xs-12">
      <form method="post" action="{:url('resort')}">
        <table class="table table-striped table-bordered table-hover" id="dynamic-table">
          <thead>
            <tr>
              <th>用户ID</th>
              <th>登录名</th>
              <th>注册手机</th>
              <th>启用状态</th>
              <th>上次登录时间</th>
              <th>上次登录IP</th>
              <th>注册时间</th>
              <th class="center">操作</th>
            </tr>
          </thead>
          <tbody>
            <?php $list = $res->all(); ?>
            {volist name="$list" id="vo"}
              <tr>
                <td>
                  {$vo.id}
                </td>
                <td>
                  {$vo.name}
                </td>
                <td>
                  {$vo.mobile}
                </td>
                <td>
                  {$vo.status|get_field_text='user_status',###}
                </td>
                <td>
                  {$vo.last_login_time|format_show_time=###}
                </td>
                <td>
                  {$vo.last_ip}
                </td>
                <td>
                  {$vo.create_time}
                </td>
                <td class="center">
                  <?php if($vo["status"]): ?>
                    <?php if($auth->check('lock')): ?>
                      <a class="red" href='javascript:void(0)' onclick="alert_del('{:url("lock", array("id" => $vo["id"]))}', '确认要锁定吗？');" class="tooltip-error" data-rel="tooltip">
                        <i class="ace-icon fa fa-lock bigger-130"></i>锁定
                      </a>
                    <?php endif; ?>
                  <?php else: ?>
                    <?php if($auth->check('unlock')): ?>
                      <a class="green" href='javascript:void(0)' onclick="alert_del('{:url("unlock", array("id" => $vo["id"]))}', '确认要解锁吗？');" class="tooltip-error" data-rel="tooltip">
                        <i class="ace-icon fa fa-unlock bigger-130"></i>解锁
                      </a>
                    <?php endif; ?>
                  <?php endif; ?>
                </td>
              </tr>
            {/volist}
          </tbody>
        </table>
      </form>
      <div>
        <?php echo($res->render()); ?>
      </div>
    </div>
  </div>
{/block}